<?php
namespace app\model;

use think\facade\Db;

/**
 * ClassName:模型操作基类
 * @auditor LeiJunXiang
 * @time 2024/09/26
 */
class ModelBase
{
    //对象key
    protected $objKey;

    /**
     * （属性数组）获取属性
     */
    public function getAttribute()
    {
        return get_object_vars($this);
    }

    /**
     * 设置属性（属性数组）
     */
    public function setAttribute($data)
    {
        if ($data) {
            foreach ($data as $key => $value) {
                if (property_exists($this, $key)) {
                    $this->$key= $value;
                }
            }
        }
    }

    /**
     * @return mixed
     */
    public function getObjKey()
    {
        return $this->objKey;
    }

    /**
     * @param mixed $objKey
     */
    public function setObjKey($objKey)
    {
        $this->objKey = $objKey;
    }

}